b = []
for i in range(2, 1000):
    a = 1
    for j in range(2, i//2):
        if i%j==0:
            a = 0
            break
        if a:
            b.append(i)

n = ['zero', 'one', 'two', 'three', 'four', 'five', 'six', 'seven', 'eight', 'nine']
c = input().replace('9', '&').replace('8', '&').replace('7', '&').replace('6', '&')\
     .replace('5', '&').replace('4', '&').replace('3', '&').replace('2', '&')\
     .replace('1', '&').replace('0', '&')
if not(len(c.split())==3) or "&" in c:
    print('Wrong input')

else:
    d = c.split()
    w = ''
    for i in d:
        w += str(n.index(i))
    k = int(w)
s = []
for i in b:
    s.append([abs(k - i), i ])
print(sorted(s)[0][1])
